package com.zpl.common.support.hook;

/**
 * @author zhupanlin
 * @version 1.0
 * @description: TODO
 * @date 2024/9/8 12:10
 */
public final class ShutdownHooks {
    
    private ShutdownHooks() {}

    /**
     * 添加rpc shutdown hook
     * @param rpcShutdownHook 钩子函数
     */
    public static void rpcShutdownHook(final RpcShutdownHook rpcShutdownHook) {
        Runtime.getRuntime().addShutdownHook(new Thread(){
            @Override
            public void run() {
                rpcShutdownHook.hook();
            }
        });
    }
    
}
